const Service = require("egg").Service;

class HomeService extends Service {
    async getList() {
        let res = await this.app.mysql.select("districts", {
            where: { deep: 1 }
        });
        let arr = new Set([]);
        res.forEach(v => {
            arr.add(v.pinyin_shor.slice(0, 1).toUpperCase())
        });
        console.log(arr, "A".charCodeAt());
        arr = Array.from(arr);
        arr.sort((a, b) => {
            return a.charCodeAt() - b.charCodeAt()
        })
        console.log(arr);
        return res
    }
}

module.exports = HomeService;